﻿@model HouseAgencySite.Models.HtmlContents
@{
    ViewBag.Title = "内容管理新增";
    Layout = "~/Areas/Admin/Views/Shared/_EditLayout.cshtml";
}

@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <table class="table table-bordered" style="width:100%;">
        <thead>
            <tr class="success">
                <th colspan="3" class="text-center xl">内容管理新增</th>
            </tr>
        </thead>
        <tr>
            <td>
              @Html.HiddenFor(model => model.Guid)
                <div class="editor-label">
                    @Html.LabelFor(model => model.Title)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Title)
                    @Html.ValidationMessageFor(model => model.Title)
                </div>
            </td>
        </tr>
        <tr>
            <td>

                <div class="editor-label">
                    @Html.LabelFor(model => model.SubTitle)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.EditorFor(model => model.SubTitle)
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Kewords)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Kewords)
                </div>
            </td>
        </tr>
        <tr>
            <td>

                <div class="editor-label">
                    @Html.LabelFor(model => model.ZhaiYao)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.TextAreaFor(model => model.ZhaiYao)
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Description)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.TextAreaFor(model => model.Description)
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="editor-label">
                    @Html.LabelFor(model => model.ModuleType)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.DropDownListFor(model => model.ModuleType, HouseAgencySite.Utils.ParamHelper.HtmlContentType(), new { @class = "form-control", style = "width:150px" })
                    @Html.ValidationMessageFor(model => model.ModuleType)
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="editor-label">
                    @Html.LabelFor(model => model.AttachUrl)
                </div>
            </td>
            <td>
                <div class="editor-field form-inline">
                    <input type="file" id="AttachUrl" name="AttachUrl"><input type="button" id="btnUpload" value="上传图片" class="btn btn-primary" />
                    <div class="carousel-inner" id="imgpreview">
                    </div>
                </div>
            </td>
        </tr>


    </table>
    <div class="text-center alert alert-info alert-dismissabl">
        <input type="button" value="保  存" class="btn btn-primary" id="btnSubmit" />
        <input type="button" value="关  闭" class="btn btn-primary" id="btnClose" />
    </div>
}

<script type="text/javascript">

    window.onload = function () {
        var editor = CKEDITOR.replace('Description');
        CKFinder.setupCKEditor(editor, '/Controls/ckfinder/');
        var zhaiYao = CKEDITOR.replace('ZhaiYao');
        CKFinder.setupCKEditor(zhaiYao, '/Controls/ckfinder/');
    };
    $(function () {
        $("#btnUpload").click(function () {
            $('#AttachUrl').uploadify("upload");
        })
        var title = encodeURI($("#Title").val());
        $('#AttachUrl').uploadify({
            'buttonText': '请选择上传文件',
            'swf': '@Url.Content("~/Controls/uploadify/uploadify.swf")',
            'auto': false,
            'multi': false,
            'uploader': '@Url.Action("Upload", "File", new { ResourceID = Model.Guid })' + "&Description=" + title,
            'onUploadSuccess': function () {
                LoadImgs('@(Model.Guid)', 'imgpreview');
            }
        });
        LoadImgs('@(Model.Guid)', 'imgpreview');
    });
</script>
